package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 食物种类枚举
 */
@Getter
public enum FoodTypeEnum implements IEnum<Integer> {


    BALANCE_MAN(0, "均衡饮食（男）不控油，营养均衡"),
    BALANCE_WOMAN(1,  "均衡饮食（女）不控油，营养均衡，碳水稍少"),
    MUSCLE_BUILDER(2, "增肌（面向男性，多加蛋白质（可以加价或者用便宜的蛋白质））"),
    LOSE_WEIGHT_LOW(3,  "减脂削弱版（面向普通减脂男，不控油，减碳水）"),
    LOSE_WEIGHT(4,  "减脂（面向普通减脂女，增强减脂男，控油，减碳水）"),
    LOSE_WEIGHT_ENTRANCE(5,  "减脂增强版（面向增强减脂女，控油，碳水只留一点）"),

    ;

    private int type;

    private String name;

    FoodTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static FoodTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static FoodTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
